using System;
using System.Collections.Generic;
using System.Text;

namespace DDW
{
	public class IdentifierExpression : PrimaryExpression, IType
	{
		public IdentifierExpression()
		{
		}
		public IdentifierExpression(string[] identifier)
		{
			this.identifier = identifier;
		}

		private TokenID startingPredefinedType = TokenID.Invalid;
		public TokenID StartingPredefinedType
		{
			get { return startingPredefinedType; }
			set { startingPredefinedType = value; }
		}
		public bool StartsWithPredefinedType
		{
			get
			{
				if (startingPredefinedType == TokenID.Invalid)
				{
					return false;
				}
				else
				{
					return true;
				}
			}
		}

		protected string[] identifier;
		public string[] Identifier
		{
			get { return identifier; }
			set { identifier = value; }
		}

		private List<int> rankSpecifiers = new List<int>();
		public List<int> RankSpecifiers
		{
			get { return rankSpecifiers; }
			set { rankSpecifiers = value; }
		}

		public override void ToSource(StringBuilder sb)
		{
			string dot = "";
			for (int i = 0; i < identifier.Length; i++)
			{				
				sb.Append(dot + identifier[i]);
				dot = ".";
			}
		}
	}
}
